//
//  StatusCellBottomView.m
//  kuangjia
//
//  Created by 张帅 on 15/10/2.
//  Copyright © 2015年 ZhangShuai. All rights reserved.
//

#import "StatusCellBottomView.h"
#import "UIButton+bottom.h"
@interface StatusCellBottomView()

@property(nonatomic,strong) UIButton *forwardButton;
@property(nonatomic,strong) UIButton *commonButton;
@property(nonatomic,strong) NSArray *buttonViews;
@property(nonatomic,strong) UIButton *likeButton;


@end

@implementation StatusCellBottomView


-(UIButton *)forwardButton{

    if (_forwardButton==nil) {
        _forwardButton=[[UIButton alloc] initWithTitle:@"转发" image: [UIImage imageNamed:@"timeline_icon_retweet"] color:[UIColor darkGrayColor]
fontSize:12];
        
    }
    return _forwardButton;
}

-(UIButton *)commonButton{
    
    if (_commonButton==nil) {
        _commonButton=[[UIButton alloc] initWithTitle:@"评论" image: [UIImage imageNamed:@"timeline_icon_comment"] color:[UIColor darkGrayColor]
                                              fontSize:12];
        
    }
    return _commonButton;
}

-(UIButton *)likeButton{
    
    if (_likeButton==nil) {
        _likeButton=[[UIButton alloc] initWithTitle:@"赞" image: [UIImage imageNamed:@"timeline_icon_unlike"] color:[UIColor darkGrayColor]
                                             fontSize:12];
        
    }
    return _likeButton;
}


-(instancetype)initWithFrame:(CGRect)frame{
    if (self==[super initWithFrame: frame]) {
        [self setupUI];
    }
    return  self;
}

-(instancetype)initWithCoder:(NSCoder *)aDecoder{

    if (self==[super initWithCoder:aDecoder]) {
        [self setupUI];
    }
    return self;
}


- (void)setupUI{
    

    [self setBackgroundColor:[UIColor groupTableViewBackgroundColor]];

    
    [self addSubview:self.forwardButton];
    
    [self addSubview:self.commonButton];
    
    [self addSubview:self.likeButton];
    
    // 底部View布局

    [self.forwardButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(10);
        
    }];
    [self.commonButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
    }];
    
    [self.likeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-10);
    }];
    
    self.buttonViews =@[self.forwardButton,self.commonButton,self.likeButton];
    
    
 }

- (void)updateConstraints {
    [self.buttonViews updateConstraints:^(MASConstraintMaker *make) {
        make.baseline.equalTo(self.mas_centerY).with.offset(10);
    }];
    
    //according to apple super should be called at end of method
    [super updateConstraints];
}


@end
